package com.linkhub.oms.dao.mpservice.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.linkhub.oms.common.enums.mp.DataStatusEnum;
import com.linkhub.oms.dao.mapper.LogisticFreightTemplateDetailEntityMapper;
import com.linkhub.oms.dao.mpservice.ILogisticFreightTemplateDetailService;
import com.linkhub.oms.entity.LogisticFreightTemplateDetailEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 物流运费模板详情表 服务实现类
 * </p>
 *
 * @author Frank
 * @since 2024-06-23
 */
@Service
public class LogisticFreightTemplateDetailServiceImpl extends ServiceImpl<LogisticFreightTemplateDetailEntityMapper, LogisticFreightTemplateDetailEntity> implements ILogisticFreightTemplateDetailService {

    @Override
    public List<LogisticFreightTemplateDetailEntity> listByFreightTemplateId(Long logisticFreightTemplateId) {
        if (Objects.isNull(logisticFreightTemplateId)) {
            return Lists.newArrayList();
        }
        return super.lambdaQuery()
                .eq(LogisticFreightTemplateDetailEntity::getLogisticFreightTemplateId, logisticFreightTemplateId)
                .eq(LogisticFreightTemplateDetailEntity::getDataStatus, DataStatusEnum.ENABLE)
                .list();
    }
}
